const TODOMVC = 'TODOMVC'
export let todoStorage = {
    fetch() {
       return JSON.parse(localStorage.getItem(TODOMVC))||[]
    },
    save(todos) {
        localStorage.setItem(TODOMVC, JSON.stringify(todos))
    }
}

export let filterTodos={
    all(todos){
        return todos
    },
    active(todos){
        return todos .filter(todo=>!todo.completed)
    },
    completed(todos){
        return todos .filter(todo=>todo.completed)
    }
}